package com.qf.ayc.income.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.ayc.customers.service.ICustomersService;
import com.qf.ayc.income.entity.Income;
import com.qf.ayc.income.mapper.IncomeMapper;
import com.qf.ayc.income.service.IIncomeService;
import com.qf.ayc.utils.ResultVo;
import com.qf.ayc.vips.entity.Vips;
import com.qf.ayc.vips.mapper.VipsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author BeautyFairy
 * @since 2024-02-22
 */
@CrossOrigin
@RestController
@RequestMapping("/income/income")
public class IncomeController {

    @Autowired
    private IIncomeService iIncomeService;
    @Autowired
    private  IncomeMapper incomeMapper;


    @PostMapping("/add")
    public ResultVo add(@RequestBody Income income){
        iIncomeService.add(income);
        return  ResultVo.ok("200","添加收入");
    }

    //返整个收入表！！！
    @GetMapping("/getlist")
    public ResultVo getlist(){
        QueryWrapper<Income> wrapper = new QueryWrapper<>();
        List<Income> getlist = incomeMapper.selectList(wrapper);
        return ResultVo.ok("200","查询收入表",getlist);
    }

    //只返钱数值
    @PostMapping("/getlistmoney")
    public ResultVo select(){
        List<Integer> list=iIncomeService.getlist();

        return ResultVo.ok("200","查询收入",list);
    }





}
